import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);
const home = () => import("./../views/home/index");
const bz = () => import("./../views/bz/index");
const sh = () => import("./../views/sh/index");
const gf = () => import("./../views/gf/index");
const iiif = () => import("./../views/iiif/index");
const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    name: "home",
    component: home,
    meta: {
      title: "印谱上传",
      des: "印谱上传管理",
    },
  },
  {
    path: "/bz",
    name: "bz",
    component: bz,
    meta: {
      title: "印章标注",
      des: "印章标注管理",
    },
  },
  {
    path: "/sh",
    name: "sh",
    component: sh,
    meta: {
      title: "印章管理",
      des: "印章管理管理",
    },
  },
  {
    path: "/gf",
    name: "gf",
    component: gf,
    meta: {
      title: "人物规范",
      des: "人物规范管理",
    },
  },
  {
    path: "/iiif",
    name: "iiif",
    component: iiif,
    meta: {
      title: "iiif",
      des: "iiif",
    },
  },
];

const router = new Router({
  mode: "hash",
  routes,
  scrollBehavior() {
    return { x: 0, y: 0 };
  },
});

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

export default router;
